/* * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  background-color: #f4f4f9;
  color: #333;
  padding: 20px;
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.status-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-left: 5px solid #3498db;
}

.status-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #2c3e50;
  font-weight: 600;
}

.status-value {
  font-size: 24px;
  font-weight: bold;
  color: #2980b9;
}

.status-boolean {
  font-size: 18px;
  font-weight: bold;
}

.status-boolean.yes {
  color: #27ae60;
}

.status-boolean.no {
  color: #e74c3c;
}

.bluetooth-connect-section {
  text-align: center;
  margin-bottom: 30px;
}

.connect-btn {
  background-color: #27ae60;
  border: none;
  color: white;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.connect-btn:hover {
  background-color: #219a52;
}

.connect-btn:disabled {
  background-color: #95a5a6;
  cursor: not-allowed;
}

.status-disconnected {
  color: #e74c3c;
  font-weight: bold;
}

.status-connected {
  color: #27ae60;
  font-weight: bold;
} */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ddd;
}

h1 {
  color: #2c3e50;
  margin-bottom: 10px;
}

.status-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.status-connected {
  color: #27ae60;
  font-weight: bold;
}

.status-disconnected {
  color: #e74c3c;
  font-weight: bold;
}

.status-sending {
  color: #f39c12;
  font-weight: bold;
}

.status-boolean.yes {
  color: #27ae60;
}

.status-boolean.no {
  color: #e74c3c;
}

.button-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

button {
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
}

#connectBtn {
  background-color: #3498db;
  color: white;
}

#connectBtn:hover {
  background-color: #2980b9;
}

#connectBtn:disabled {
  background-color: #95a5a6;
  cursor: not-allowed;
}

#clearBtn {
  background-color: #f39c12;
  color: white;
}

#clearBtn:hover {
  background-color: #e67e22;
}

#stopBtn {
  background-color: #e74c3c;
}

/* 波形图样式 */
.waveform-card {
  margin-bottom: 20px;
}

.waveform-container {
  position: relative;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #dee2e6;
}

.waveform-container canvas {
  width: 100%;
  height: 200px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

.waveform-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 14px;
}

.waveform-label {
  color: #666;
  font-weight: 500;
}

.waveform-status {
  color: #007bff;
  font-weight: 600;
}

#stopBtn:hover {
  background-color: #c0392b;
}

.data-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* 按压波形图占用两个网格宽度 */
.compression-waveform {
  grid-column: span 2;
}

/* 通气波形图占用一个网格宽度 */
.ventilation-waveform {
  grid-column: span 1;
}

/* 在小屏幕上恢复正常布局 */
@media (max-width: 768px) {
  .compression-waveform,
  .ventilation-waveform {
    grid-column: span 1;
  }
}

.data-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.data-card h3 {
  color: #2c3e50;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.data-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 8px 0;
}

.data-item:nth-child(even) {
  background-color: #f9f9f9;
}

.data-label {
  font-weight: bold;
  color: #7f8c8d;
}

.data-value {
  font-weight: bold;
}

.instructions {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-top: 30px;
}

.instructions h3 {
  color: #2c3e50;
  margin-bottom: 15px;
}

.instructions ul {
  padding-left: 20px;
}

.instructions li {
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .button-container {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}

/* 原有样式保持不变，只添加新样式 */

#printLog {
  background-color: #9b59b6;
  color: white;
}

#printLog:hover {
  background-color: #8e44ad;
}

.log-container {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 600px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  max-height: 80vh;
  overflow-y: auto;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.log-content {
  font-family: monospace;
  white-space: pre-wrap;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  max-height: 50vh;
  overflow-y: auto;
}

.close-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* 按压状态显示样式 */
.compression-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.status-image {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 10px;
  transition: all 0.3s ease;
}

.status-image.pressing {
  filter: grayscale(100%) brightness(0.7);
  transform: scale(0.95);
}

.status-image.released {
  filter: none;
  transform: scale(1);
}

.status-text {
  text-align: center;
  font-weight: bold;
  font-size: 16px;
  color: #2c3e50;
}

.status-text.pressing {
  color: #7f8c8d;
  font-style: italic;
}

.status-text.correct {
  color: #27ae60;
}

.status-text.shallow {
  color: #f39c12;
}

.status-text.deep {
  color: #e74c3c;
}

/* CPR评分卡片样式 */
.score-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-left: 5px solid #ffd700;
}

.score-card h3 {
  color: white;
  margin-bottom: 20px;
  text-align: center;
}

.score-display {
  text-align: center;
  margin-bottom: 20px;
}

.score-number {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 10px;
}

.score-value {
  color: #ffd700;
}

.score-unit {
  font-size: 24px;
  color: #ecf0f1;
}

.score-grade {
  margin-top: 10px;
}

.grade-text {
  font-size: 24px;
  font-weight: bold;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.2);
}

.score-breakdown {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 15px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  color: #ecf0f1;
}

.breakdown-item:last-child {
  margin-bottom: 0;
}

/* 训练过程中隐藏统计和评分 */
.data-card.training-statistics,
.data-card.score-card {
  display: none;
}

.data-card.training-statistics.show,
.data-card.score-card.show {
  display: block;
}

/* 评分弹窗样式 */
.score-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.score-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 15px;
  padding: 25px;
  width: 85vw;
  height: 47.8125vw; /* 16:9 比例: 85vw * 9/16 = 47.8125vw */
  max-width: 1400px;
  max-height: 787.5px; /* 16:9 比例: 1400px * 9/16 = 787.5px */
  min-width: 900px;
  min-height: 506.25px; /* 16:9 比例: 900px * 9/16 = 506.25px */
  overflow: hidden; /* 隐藏滚动条 */
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.4s ease;
  display: flex;
  flex-direction: column;
}

@keyframes slideIn {
  from {
    transform: translate(-50%, -60%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

.score-modal-header {
  text-align: center;
  margin-bottom: 10px;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 8px;
  flex-shrink: 0; /* 不缩放 */
}

.score-modal-title {
  font-size: 20px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 6px;
  line-height: 1.2;
}

.score-modal-subtitle {
  font-size: 14px;
  color: #7f8c8d;
  line-height: 1.2;
}

.final-score-display {
  text-align: center;
  margin: 8px 0;
  padding: 10px 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  color: white;
  flex-shrink: 0; /* 不缩放 */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  min-height: 50px;
}

.final-score-number {
  font-size: 28px;
  font-weight: bold;
  color: #ffd700;
  margin: 0;
  line-height: 1;
}

.final-score-unit {
  font-size: 14px;
  color: #ecf0f1;
  margin: 0;
  line-height: 1;
}

.final-score-grade {
  font-size: 16px;
  font-weight: bold;
  margin: 0;
  line-height: 1;
}

.statistics-grid {
  display: grid;
  grid-template-columns: 1fr 2fr; /* 第一行：评分 | 评分细则 */
  grid-template-rows: auto auto; /* 两行布局 */
  gap: 15px;
  margin: 8px 0;
  flex: 1; /* 占据剩余空间 */
  overflow: hidden;
  min-height: 0;
}

/* 评分显示区域 */
.score-summary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  grid-column: 1;
  grid-row: 1;
}

.score-summary h4 {
  color: white;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
}

.score-summary .score-display {
  text-align: center;
}

.score-summary .final-score-number {
  font-size: 42px;
  font-weight: bold;
  color: #ffd700;
  margin: 5px 0;
  line-height: 1;
}

.score-summary .final-score-unit {
  font-size: 18px;
  color: #ecf0f1;
  margin: 0;
}

.score-summary .final-score-grade {
  font-size: 20px;
  font-weight: bold;
  margin-top: 8px;
  color: white;
}

/* 统计区域布局 */
.statistics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  grid-column: 1 / -1;
  grid-row: 2;
}

.stat-group h4 {
  color: #2c3e50;
  margin-bottom: 12px;
  font-size: 16px;
  flex-shrink: 0;
  text-align: center;
  font-weight: bold;
  line-height: 1.2;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 4px 0;
  font-size: 14px;
  line-height: 1.4;
}

.stat-label {
  color: #7f8c8d;
  font-weight: 500;
  flex: 1;
}

.stat-value {
  color: #2c3e50;
  font-weight: bold;
  text-align: right;
  min-width: 60px;
}

.stat-value.correct {
  color: #27ae60;
}

.stat-value.error {
  color: #e74c3c;
}

/* 为统计组添加滚动功能 */
.stat-group {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #3498db;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.stat-group .stat-items {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px; /* 为滚动条留出空间 */
}

/* 自定义滚动条样式 */
.stat-items::-webkit-scrollbar,
.score-items::-webkit-scrollbar {
  width: 4px;
}

.stat-items::-webkit-scrollbar-track,
.score-items::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.stat-items::-webkit-scrollbar-thumb,
.score-items::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

.stat-items::-webkit-scrollbar-thumb:hover,
.score-items::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 红十字会评分细则样式 */
.scoring-breakdown {
  background: #e8f4fd;
  border-radius: 8px;
  padding: 15px;
  margin: 0;
  border-left: 4px solid #3498db;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-column: 2;
  grid-row: 1;
}

.scoring-breakdown h4 {
  color: #2c3e50;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 12px;
  text-align: center;
  border-bottom: 1px solid #bdc3c7;
  padding-bottom: 8px;
  line-height: 1.2;
}

.score-items {
  display: flex;
  flex-direction: column;
  gap: 0; /* 移除gap，由margin-bottom控制间距 */
  overflow-y: auto;
  flex: 1;
  padding-right: 4px; /* 为滚动条留出空间 */
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: white;
  border-radius: 6px;
  border-left: 3px solid #3498db;
  transition: all 0.3s ease;
  margin-bottom: 6px;
}

.score-item:hover {
  background: #f8f9fa;
  transform: translateX(3px);
}

.score-category {
  color: #2c3e50;
  font-weight: 500;
  font-size: 14px;
  flex: 1;
  line-height: 1.4;
}

/* 评分细则标题中的扣分说明样式 */
.score-category .deduction-note {
  display: block;
  font-size: 10px;
  color: #e74c3c;
  font-weight: normal;
  margin-top: 2px;
  font-style: italic;
}

.score-points {
  color: #3498db;
  font-weight: bold;
  font-size: 13px;
  min-width: 55px;
  text-align: right;
  line-height: 1.4;
}

/* 评分细则中的扣分说明样式 */
.score-points small {
  display: block;
  font-size: 10px;
  color: #e74c3c;
  font-weight: normal;
  margin-top: 2px;
  line-height: 1.2;
}

.modal-actions {
  text-align: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #ecf0f1;
  flex-shrink: 0; /* 不缩放 */
}

.modal-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  margin: 0 8px;
  transition: background 0.3s;
}

.modal-btn:hover {
  background: #2980b9;
}

.modal-btn.secondary {
  background: #95a5a6;
}

.modal-btn.secondary:hover {
  background: #7f8c8d;
}

/* 弹窗响应式设计 */
@media (max-width: 1024px) {
  .score-modal-content {
    width: 90vw;
    height: 50.625vw; /* 16:9 比例: 90vw * 9/16 = 50.625vw */
    min-width: 700px;
    min-height: 393.75px; /* 16:9 比例: 700px * 9/16 = 393.75px */
  }
  
  .final-score-number {
    font-size: 38px;
  }
  
  .final-score-grade {
    font-size: 18px;
  }
  
  .stat-item {
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  .score-modal-content {
    width: 95vw;
    height: 53.4375vw; /* 16:9 比例: 95vw * 9/16 = 53.4375vw */
    min-width: 500px;
    min-height: 281.25px; /* 16:9 比例: 500px * 9/16 = 281.25px */
    padding: 18px;
  }
  
  .statistics-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .final-score-number {
    font-size: 32px;
  }
  
  .final-score-grade {
    font-size: 16px;
  }
  
  .stat-group {
    padding: 15px;
  }
  
  .stat-group h4 {
    font-size: 16px;
    margin-bottom: 12px;
  }
  
  .stat-item {
    font-size: 13px;
    margin-bottom: 8px;
  }
}